import java.util.Scanner;
import java.util.Stack;

/**
 * 四则运算
 * 输入一个表达式（用字符串表示），求这个表达式的值。
 * 保证字符串中的有效字符包括[‘0’-‘9’],‘+’,‘-’, ‘*’,‘/’ ,‘(’， ‘)’,‘[’, ‘]’,‘{’ ,‘}’。且表达式一定合法。
 */
public class HJ50 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String str = scanner.nextLine();
            str = str.replace("{", "(");
            str = str.replace("}", ")");
            str = str.replace("[", "(");
            str = str.replace("]", ")");

            System.out.println(ops(str));
        }
    }

    private static int ops(String str) {
        int num = 0;
        char sign = '+';
        Stack<Integer> stack = new Stack<>();
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if(Character.isDigit(c)){
                num = num*10+ c-'0';
            }

            if(c == '('){
                int count = 1;
                int j = i+1;

                while (count>0){
                    if(str.charAt(j) == '(') count++;
                    if(str.charAt(j) == ')') count--;
                    j++;
                }
                num = ops(str.substring(i+1,j-1));
                i = j-1;
            }

            if(c=='+' || c=='-' || c=='*' || c=='/' || i==str.length()-1){
                if(sign=='+'){
                    stack.push(num);
                }
                if(sign=='-'){
                    stack.push(-1*num);
                }
                if(sign=='*'){
                    stack.push(stack.pop()*num);
                }
                if(sign=='/'){
                    stack.add(stack.pop()/num);
                }

                sign = c;
                num = 0;
            }
        }
        int res = 0;
        for (Integer n : stack) {
            res+=n;
        }
        return res;
    }
}
